package com.cai.util;

import com.cai.pojo.Mail;

/**
 * @author RuoLi
 */
public class MailMessageUtil {
    static Mail mail = new Mail();
    String codeSubject = "在线刷题网站| 欢迎注册！";
    String codeSubject1= "在线刷题网站| 重置密码！";
    String codeContent = "你好,新用户";
    String codeContent1="你的账号为：";
    String codeContent2 = "你的验证码为：";
    String codeContent3="你好,用户账号：";
    String codeContent5="你们新密码：";
    String codeContent4="当前账号未激活,请激活后使用";

    /**
     * 通知用户发送账号和验证码注册成功
     *
     * @param receiptUser 用户邮箱
     * @param code        验证码
     * @param account     账号
     */
    public Mail sendCodeMessage(String receiptUser, String code, String account) {
        mail.setSendSubject(codeSubject);
        mail.setSendContent("<p>"+codeContent+"</p>"+
                            "<p>"+codeContent1+"<a href=\"#\">"+account+"</a></p>"+
                            "<p>"+codeContent2+"<a href=\"#\">"+code+"</a></p>"+
                            "<p>"+codeContent4+"</p>");
        mail.setReceiptUser(receiptUser);
        return mail;
    }

    /**
     * 通知用户 发送验证码 获取验证码后修改密码
     * @param receiptUser 用户邮箱
     * @param code 验证码
     */
    public Mail sendCodePassword(String receiptUser,String code,String userAccount){
       mail.setReceiptUser(receiptUser);
       mail.setSendSubject(codeSubject1);
       mail.setSendContent("<p>"+codeContent3+"<a href=\"#\">"+userAccount+"</a></p>"+
                           "<p>"+codeContent2+"<a href=\"#\">"+code+"</a></p>");
       return mail;
    }
    public Mail sendNewPassword(String receiptUser,String newPassword,String userAccount){
        mail.setReceiptUser(receiptUser);
        mail.setSendSubject(codeSubject1);
        mail.setSendContent("<p>"+codeContent3+"<a href=\"#\">"+userAccount+"</a></p>"+
                            "<p>"+codeContent5+"<a href=\"#\">"+newPassword+"</a></p>");
        return mail;
    }
}
